#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<time.h>
#define N 10
void sort(int* p, int x)
{
	for (int i = 0; i < x-1; i++)
	{
		int num = i;
		int tem = p[i + 1];
		while (num >= 0)
		{
		
			if (p[num] > tem)
			{
				p[num + 1] = p[num];
				num--;
			}
			else break;
		}
		p[num + 1] = tem;

	}
}

void ShellSort(int* a, int n)
{
	int gap = 6;
	while (gap > 1)
	{
		gap = gap / 3 + 1;

		for (int j = 0; j < n - gap; j++)
		{
			int k = j;
			int n = a[j + gap];
			while (k >= 0)
			{
				if (a[k] > n)
				{
					a[k + gap] = a[k];
					k -= gap;
				}
				else break;
			}
			a[k + gap] = n;
		}

	}
}
void swap(int* p, int* w)
{
	int tem = *p;
	*p = *w;
	*w = tem;
}
void selectsort(int* p, int x)
{
	int begin = 0, end = x - 1;
	
	while (begin < end)
	{
		int max = end, min = begin;
		for (int i = begin; i <= end; i++)
		{
			if (p[i] < p[min])
			{
				min = i;
			}
			if (p[i] > p[max])
			{
				max = i;
			}
		}
		swap(&p[begin], &p[min]);
		if (begin == max)
			max = min;
		swap(&p[end], &p[max]);
		begin++;
		end--;
	}
}

void (*p[3])(int*, int) = { sort,ShellSort,selectsort };
int main()
{
	srand(time(0));
	int arr[N] = {0};
	for (int i = 0; i < N; i++)
	{
		arr[i] = rand() % 100;
	}
	int sz = sizeof(arr) / sizeof(arr[0]);
	int a = 0;
	scanf("%d", &a);

	p[a](arr, sz);
	
	for (int i = 0; i < sz; i++)
	{
		printf("%d ", arr[i]);
	}
}